package com.zst.webflux.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.IntStream;

@RestController
public class MainController {
    private final Map<String, String> data = new ConcurrentHashMap<>();

    @GetMapping("/act1")
    public Mono<String> act1() {
        return Mono.just("Hello Jazz");
    }

    @GetMapping("/act2")
    public Flux<String> act2() {
        return Flux.fromStream(IntStream.range(0, 100).mapToObj(Integer::toString));
    }
}
